import service from "@/utils/request";
import internal from "stream";
const DEPT_BASE_URL = "/api/";

//羊只称重列表
class Breeding {
  static getBreedingList(queryParams?: getBreeding) {
    return service<any, getBreeding>({
      url: `${DEPT_BASE_URL}BreedingWeigh/BreedingWeighList`,
      method: "post",
      data: queryParams,
    });
  }

  //称重类型
  static BreedingType() {
    return service({
      url: `${DEPT_BASE_URL}BreedingWeigh/WeighCategoryList`,
      method: "get",
    });
  }

  //品种类型
  static SheepVarity() {
    return service({
      url: `${DEPT_BASE_URL}EarTage/ShowEarTageBreed`,
      method: "get",
    });
  }

  //删除称重信息
  static DeleteBreeding(data: any) {
    return service({
      url: `${DEPT_BASE_URL}BreedingWeigh/DeleteWeighCategory`,
      method: "post",
      data,
    });
  }

  ///称重添加
  static AddBreeding(data: AddBreeding) {
    return service({
      url: `${DEPT_BASE_URL}BreedingWeigh/AddWeighCategory`,
      method: "post",
      data,
    });
  }

  //耳号列表
  static EarTagLisShow(presentState: any, sheepType: any) {
    return service({
      url: `${DEPT_BASE_URL}SheepFileModels/IsSexSheepfilemodel`,
      method: "get",
      params: {
        presentState: presentState,
        sheepType: sheepType,
      },
    });
  }

  ///称重修改
  static UpdateBreeding(data: AddBreeding) {
    return service({
      url: `${DEPT_BASE_URL}BreedingWeigh/UpdateWeighCategory`,
      method: "post",
      data: data,
    });
  }
}

export default Breeding;

export interface getBreeding {
  pageIndex: number;
  pageSize: number;
  startDate: string;
  endDate: string;
  earTag: string;
  weighCategory: number;
  variety: number;
  sheepRescissionSex: boolean;
  startAge: number;
  endAge: number;
}

export interface AddBreeding {
  breedingId: number;
  weighDate: any;
  earTag: string;
  weighCategory: number;
  weight: number;
}
